'use strict';

import React, { PureComponent } from 'react';

import {
  StyleSheet,
  View,
  TouchableOpacity,
  Text
} from 'react-native';


class PopoverConent extends PureComponent {
	onPress(key){
		this.props.popoverPress&&this.props.popoverPress(key);
	}
	getconent(){
		return this.props.titleArr.map((item,key)=>{
			return (
				<TouchableOpacity key={item.key} style={[key===this.props.titleArr.length-1 ?styles.btnwidth:styles.btn]} onPress={this.onPress.bind(this,item.key)}>
					<Text style={styles.text}>{item.name}</Text>
				</TouchableOpacity>
			);
		});
	}
	render() {
      return (
        <View style={{flex:1}}>
			{this.getconent()}
        </View>
      );
    }
}

const styles = StyleSheet.create({
	btnwidth:{flexDirection:'row',flex:1,alignItems: 'center',justifyContent: 'center',},
	btn:{flexDirection:'row',flex:1,alignItems: 'center',justifyContent: 'center',borderBottomColor:'#E1E1E1',borderBottomWidth:1},
	text:{color:'#000',fontSize:14,},
});


export default PopoverConent;